package gen.tools.emplyee;

import gen.tools.Widgets;
import gen.tools.structures.S5;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

public class QueryEmp extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public QueryEmp() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		final Widgets wid = new Widgets();
		request.setCharacterEncoding( wid.UIcodeSet );
		response.setCharacterEncoding( wid.UIcodeSet );
		response.setContentType("application/json");
		
		final String subsysId = request.getParameter("subsysId");
		
		ArrayList<S5> alOfS5 = null;	// array list Of I1S1
		
		try {
			alOfS5 = wid.getEmpList(subsysId);
		} catch( Exception e) {
			wid.errLog(e);
		}
		System.out.println(new Gson().toJson(alOfS5));
		response.getWriter().write( new Gson().toJson(alOfS5)  );
		
		
	}

}
